//
//  WeiboBaseNavController.swift
//  SinaWeibo
//
//  Created by 风不会停息 on 2016/11/12.
//  Copyright © 2016年 风不会停息. All rights reserved.
//

import UIKit

class WeiboBaseNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    //重写pushVC的方法
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        //判断是否是第一个控制器
        if self.childViewControllers.count>0{
        viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(pop))
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: true)
    }
    
    
    func pop(){
        self.popViewController(animated: true)
    }

}
